<?php
require_once('Person.php');

class SearchedPerson extends Person{
    	protected $services		= array();
	protected $found;

	function __construct($peId, $service){
	    	parent::__construct($peId);

		$this->services[0]	= strtolower($service);
	}

	function addService($service){
	    	$this->services[]	= strtolower($service);
	}

	function foundYesNo(){
	    	$this->found		= false;

	    	foreach($this->services as &$value){
		    	switch ($generalPrivacy){
			    	case 0:
					if ($value		= email){
					    	$this->found	= true;
					}
					break;
				case 1:
					if ($value = email || $value = name){
					    	$this->found	= true;
					}
					break;
				case 2:
					//echo 'we\'re in case 2 <br />';
					if ($value = email || $value = name){
					    	$this->found	= true;
					}
					break;
				case 3:
					$this->found		= true;
					break;
				case 4:
					$this->found		= true;
					break;
				default:
					$this->found		= false;
			}
		}
	}

	function arrangeData(){
	    	switch ($this->generalPrivacy){
		    	case 0:
				$this->dataDiv	= "<p>NickName: ".$this->nickName."<br />
						Name: ".$this->name."<br />
						First name: ".$this->firstName."<br />
						email: ".$this->eMail."
						<form action=\"addContact.php\" method=\"get\">
							<input type=\"hidden\" name=\"PEID\" value=\"".$this->peId."\" />
							<input type=\"submit\" value=\"Add Contact\" />
						</form>
						</p>";
				break;
		    	case 1:
				$this->dataDiv	= "<p>NickName: ".$this->nickName."<br />
						Name: ".$this->name."<br />
						First name: ".$this->firstName."<br />
						email: ".$this->eMail."
						<form action=\"addContact.php\" method=\"get\">
							<input type=\"hidden\" name=\"PEID\" value=\"".$this->peId."\" />
							<input type=\"submit\" value=\"Add Contact\" />
						</form>
						</p>";
				break;
		    	case 2:
				$this->dataDiv	= "<p>NickName: ".$this->nickName."<br />
						Name: ".$this->name."<br />
						First name: ".$this->firstName."<br />
						email: ".$this->eMail."
						<form action=\"addContact.php\" method=\"get\">
							<input type=\"hidden\" name=\"PEID\" value=\"".$this->peId."\" />
							<input type=\"submit\" value=\"Add Contact\" />
						</form>
						</p>";
				break;
		    	case 3:
				$this->dataDiv	= "<p>NickName: ".$this->nickName."<br />
						Name: ".$this->name."<br />
						First name: ".$this->firstName."<br />
						email: ".$this->eMail."
						<form action=\"addContact.php\" method=\"get\">
							<input type=\"hidden\" name=\"PEID\" value=\"".$this->peId."\" />
							<input type=\"submit\" value=\"Add Contact\" />
						</form>
						</p>";
				break;
		    	case 4:
				$this->dataDiv	= "<p>NickName: ".$this->nickName."<br />
						Name: ".$this->name."<br />
						First name: ".$this->firstName."<br />
						email: ".$this->eMail."<br />
						Twitter: www.twitter.com/".$this->twitterName."
						<form action=\"addContact.php\" method=\"get\">
							<input type=\"hidden\" name=\"PEID\" value=\"".$this->peId."\" />
							<input type=\"submit\" value=\"Add Contact\" />
						</form>
						</p>";
				break;
		}
	}

	// Getter and Setter
	public function  getServices(){
	    	return $this->services;
	}
	public function getFound(){
	    	return $this->found;
	}
}
?>
